package com.example.controller;

import com.example.bean.Myfile;
import com.example.service.Impl.MyfileServiceImpl;

import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.time.LocalDateTime;

/**
 * Created by 殇 on 2022/7/21.
 */

@RestController
public class DemoController {

    @Autowired(required = true)
    private MyfileServiceImpl myfileService;

    @RequestMapping("/getDemo")
    public String getDemo(){
        Myfile Myfile = new Myfile();
        Myfile.setFilename("上传");
        Myfile.setFilepath("G:/game");
        Myfile.setFiletime(LocalDateTime.now().toString());
        Myfile.setId(null);
        myfileService.save(Myfile);



        return Myfile.toString();
    }

    @RequestMapping("/Test1")
    public String Test(){

        PageInfo<Myfile> pageInfo =  myfileService.SelAllByName(new Myfile(),1,3);


        return pageInfo.getList().toString();
    }

}
